<template>
  <div id="app">
    <Loading v-show="LOADING"></Loading>
    <!-- <router-view v-if="isRouterAlive"/> -->


   <!-- <router-view></router-view> -->
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive" :key="key"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive" :key="key"></router-view>

   
  </div>
</template>
<script>
 import {mapState} from 'vuex'
 import Loading from './components/loading.vue'
 import { getAppPropert } from "../src/api/index";
export default {
  name: "App",
  provide () {
   return{
     reload: this.reload
   }
 },
  data() {
    return {
      active: 1, //由于这里使用了vant 标签栏路由模式，该设置无效（但是此处不可删除）。可以自己尝试看看
      // icon: {
      //   active: require("./assets/index/selectIndex.png"),
      //   inactive:require('./assets/index/noIndex.png'),
      //    bookactive: require("./assets/index/selcetbooks.png"),
      //   bookinactive:require('./assets/index/nobooks.png'),
      //   statisticalactive: require("./assets/index/selcetstatistical.png"),
      //   statisticalinactive:require('./assets/index/nostatistical.png'),
      // },
      icon: {
        active: require("./assets/index/selectIndex1.png"),
        inactive:require('./assets/index/noIndex.png'),
         bookactive: require("./assets/index/selectBooks.png"),
        bookinactive:require('./assets/index/nobooks.png'),
        statisticalactive: require("./assets/index/selectStatistical.png"),
        statisticalinactive:require('./assets/index/nostatistical.png'),
      },
      // isRouterAlive: true
    };
  },
  components: {Loading},
  computed: {
    key(){
       let {fullPath,meta={}} = this.$route ;
       let {keepAliveKey=fullPath} = meta ;
       return keepAliveKey ;
    },
    ...mapState(['LOADING'])
  },

  //初始化页面选中状态
  created() {
    var sid=window.sid;
    sessionStorage.setItem('sid', sid );
    //由于 vant 标签栏路由模式，无法自动加载页面，所以这里需要初始化
    console.log(this.$route); //打印当前路由属性
    if (this.$route.path === "/") {
      this.$router.push("/");
    }
 
  },
 methods:{

 }
};
</script>
<style lang="scss" scoped>
body{
  background-color: #FAFAFA;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
.van-tabbar-item__icon img{
  // height: 5.66667vw !important;
}
.van-tabbar-item--active {
  color: rgba(0, 0, 0, 1);
}
.van-tabbar{
  height: 50px;
}
</style>

